package com.seek.springevent.listen;

import com.seek.springevent.event.LoanAuditEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * 模拟合同锁定业务
 */
@Component
public class ContractListenerListener implements ApplicationListener<LoanAuditEvent> {

    private static Logger logger = LoggerFactory.getLogger(ContractListenerListener.class);

    @Override
    public void onApplicationEvent(LoanAuditEvent loanAuditEvent) {
        logger.info("============开始锁定合同=============");
        try {
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        logger.info("=========锁定合同结束==============");
        logger.info("=========锁定合同耗时1s=============");
    }
}
